// const app = getApp();
Component({
  /**
   * 组件的一些选项
   */
  options: {
    addGlobalClass: true,
    multipleSlots: true,
  },
  /**
   * 组件的对外属性
   */
  properties: {
    bgColor: {
      type: String,
      default: "",
    },
    isCustom: {
      type: [Boolean, String],
      default: false,
    },
    isBack: {
      type: [Boolean, String],
      default: false,
    },
    bgImage: {
      type: String,
      default: "",
    },
  },
  /**
   * 组件的初始数据
   */
  data: {
    StatusBar: 0,
    CustomBar: 0,
    Custom: 0,
    displayArea:0
  },
  lifetimes:{
    /**
     * 组件挂载初始化
     */
    attached(){
      wx.getSystemInfo({
        success: e => {
          //console.log(e)
          let StatusBar = e.statusBarHeight;
          let custom = wx.getMenuButtonBoundingClientRect();
          // console.log(custom)
          let Custom = custom;
          let CustomBar = custom.bottom + custom.top - e.statusBarHeight;
          let capsule = wx.getMenuButtonBoundingClientRect();
          if (capsule) {
            let displayArea = {
              windowHeight: e.windowHeight,
              windowWidth: e.windowWidth,
              screenHeight: e.screenHeight,
            };
            Custom = capsule;
            CustomBar =
              capsule.bottom + capsule.top - e.statusBarHeight;
          } else {
            CustomBar = e.statusBarHeight + 50;
          }
          that.setData({
            StatusBar,
            CustomBar,
            Custom,
            displayArea
          })
        }
      })
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    
    BackPage() {
      wx.navigateBack({
        delta: 1,
      });
    },
    toHome() {
      wx.reLaunch({
        url: "/pages/index/index",
      });
    },
  },
});
